package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.ComplaintSolutionData;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ComplaintSolutionDataRepository extends PagingAndSortingRepository<ComplaintSolutionData, Long>
        , QueryDslPredicateExecutor<ComplaintSolutionData> {

    @Query("from ComplaintSolutionData where complaint_solution_report_id=:report_id and deleted=false and enabled = true")
    List<ComplaintSolutionData> selectAnswer(@Param("report_id") Long report_id);

    @Query("from ComplaintSolutionData where complaint_solution_report_id=:reportId and question_id=:questionId and deleted=false and enabled = true")
    ComplaintSolutionData selectSolutionDate(@Param("reportId") Long reportId, @Param("questionId") Long questionId);

}
